<template>
	<view class="main">
		<view class="header" @tap="userInfo.is_leader != 1 && userInfo.is_manager != 1 ? routerTo('/pages/pageB/data/infoDetil') : ''">
			<image class="avatar" :src="userInfo.avatar" mode=""></image>
			<view class="info">
				<view class="one">
					<view class="name">
						{{userInfo.nickname}}
					</view>
					<view class="post">
						{{userInfo.department_name}}
					</view>
				</view>
				<view class="two">
					{{userInfo.username}}
				</view>
			</view>
		</view>
		<ul class="list">
			<li class="item" @tap="routerTo('/pages/pageB/data/profitLoss?type=1')">
				<image src="@/static/img/jryl.png" mode=""></image>
				<view class="msg">
					今日盈利
				</view>
			</li>
			<li class="item" @tap="routerTo('/pages/pageB/data/profitLoss?type=2')">
				<image src="@/static/img/jrsh.png" mode=""></image>
				<view class="msg">
					今日亏损
				</view>
			</li>
			<li class="item" v-if="userInfo.is_leader == 1 || userInfo.is_manager == 1" @tap="routerTo('/pages/pageB/data/statistics')">
				<image src="@/static/img/cwtj.png" mode=""></image>
				<view class="msg">
					财务统计
				</view>
			</li>
			<li class="item" v-if="userInfo.is_leader != 1 && userInfo.is_manager != 1" @tap="routerTo('/pages/pageB/data/revenue')">
				<image src="@/static/img/gxsz.png" mode=""></image>
				<view class="msg">
					各项收支
				</view>
			</li>
			<li class="item" @tap="routerTo('/pages/pageB/data/rank')">
				<image src="@/static/img/ph.png" mode=""></image>
				<view class="msg">
					盈利排行
				</view>
			</li>
			<li class="item" @tap="routerTo('/pages/pageB/data/cashout')">
				<image src="@/static/img/tx.png" mode=""></image>
				<view class="msg">
					提现
				</view>
			</li>
			<li class="item" @tap="routerTo('/pages/pageB/data/jobRank')">
				<image src="@/static/img/gzl.png" mode=""></image>
				<view class="msg">
					工作量排行
				</view>
			</li>
			<li class="item" @tap="routerTo('/pages/pageB/data/setUp')">
				<image src="@/static/img/setUp.png" mode=""></image>
				<view class="msg">
					设置
				</view>
			</li>
		</ul>
		<innerTabbar seleTabbar="3"></innerTabbar>
	</view>
</template>

<script>
	import {
		innerinfo
	} from '@/api/inner.js'
	import innerTabbar from '../../components/innerTabbar.vue';
	export default {
		components: {
			innerTabbar
		},
		data(){
			return{
				userInfo:{}
			}
		},
		onLoad() {
			this.getInfo()
		},
		methods:{
			async getInfo(){
				let res = await innerinfo()
				this.userInfo = res.data
				console.log(res)
			},
			routerTo(url){
				uni.navigateTo({
					url:url
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.main{
		min-height: calc(100vh - 50px);
		background-color: #F8F8F8;
		.header{
			padding: 60px 0 30px 25px;
			background-color: #0A80F8;
			border-radius:  0 0 20px 20px;
			display: flex;
			align-items: center;
			color: #fff;
			margin-bottom: 15px;
			.avatar{
				width: 68px;
				height: 68px;
				border-radius: 1000px;
				margin-right: 10px;
			}
			.info{
				.one{
					display: flex;
					align-items: center;
					margin-bottom: 15px;
					.name{
						margin-right: 7px;
					}
					.post{
						font-size: 10px;
						color: #0A80F8;
						padding: 2px 6px;
						background-color: #fff;
						border-radius: 4px;
					}
				}
				.two{
					font-size: 12px;
				}
			}
		}
		.list{
			padding: 0 18px;
			display: flex;
			justify-content: space-between;
			flex-wrap: wrap;
			.item{
				width: 48%;
				height: 100px;
				background-color: #fff;
				border-radius: 5px;
				padding: 10px 0;
				margin-bottom: 15px;
				display: flex;
				flex-direction: column;
				align-items: center;
				justify-content: center;
				font-size: 12px;
				color: #3D3D3D;
				image{
					width: 35px;
					height: 35px;
					margin-bottom: 10px;
				}
				.unm{
					font-size: 10px;
				}
			}
		}
	}
</style>